package controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.text.html.ListView;

/**
 * 
 * @author Nelly-Kim TRAN
 * 
 * to modify a contact's information
 * 
 * All the JTextFields and JButtons are here to grant the right of editing to the user
 * 			
 *
 */


public class ModifyListener extends JFrame implements ActionListener {
	
	JTextField label1;
	JTextField label2;
	JTextField label3;
	JTextField label4;
	JTextField label5;
	JTextField label6;
	JTextField label7;
	JTextField label8;
	JButton label9;
	JButton label10;
	JButton label11;
	JTextField label12;
	JTextField label13;
	JPanel infopanel;
	
	
	
	public JTextField getLabel1() {
		return label1;
	}

	public void setLabel1(JTextField label1) {
		this.label1 = label1;
	}

	public JTextField getLabel2() {
		return label2;
	}

	public void setLabel2(JTextField label2) {
		this.label2 = label2;
	}

	public JTextField getLabel3() {
		return label3;
	}

	public void setLabel3(JTextField label3) {
		this.label3 = label3;
	}

	public JTextField getLabel4() {
		return label4;
	}

	public void setLabel4(JTextField label4) {
		this.label4 = label4;
	}

	public JTextField getLabel5() {
		return label5;
	}

	public void setLabel5(JTextField label5) {
		this.label5 = label5;
	}

	public JTextField getLabel6() {
		return label6;
	}

	public void setLabel6(JTextField label6) {
		this.label6 = label6;
	}

	public JTextField getLabel7() {
		return label7;
	}

	public void setLabel7(JTextField label7) {
		this.label7 = label7;
	}

	public JTextField getLabel8() {
		return label8;
	}

	public void setLabel8(JTextField label8) {
		this.label8 = label8;
	}

	public JButton getLabel9() {
		return label9;
	}

	public void setLabel9(JButton label9) {
		this.label9 = label9;
	}

	public JButton getLabel10() {
		return label10;
	}

	public void setLabel10(JButton label10) {
		this.label10 = label10;
	}

	public JButton getLabel11() {
		return label11;
	}

	public void setLabel11(JButton label11) {
		this.label11 = label11;
	}

	public JTextField getLabel12() {
		return label12;
	}

	public void setLabel12(JTextField label12) {
		this.label12 = label12;
	}

	public JTextField getLabel13() {
		return label13;
	}

	public void setLabel13(JTextField label13) {
		this.label13 = label13;
	}

	public ModifyListener (JTextField label1, JTextField label2, JTextField label3, JTextField label4, JTextField label5, JTextField label6, JTextField label7,
	JTextField label8, JButton label9, JButton label10, JButton label11, JTextField label12, JTextField label13, JPanel infopanel) {
		super();
		this.label1=label1;
		this.label2=label2;
		this.label3=label3;
		this.label4=label4;
		this.label5=label5;
		this.label6=label6;
		this.label7=label7;
		this.label8=label8;
		this.label9=label9;
		this.label10=label10;
		this.label11=label11;
		this.label12=label12;
		this.label13=label13;
		this.infopanel=infopanel;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		
		// Enables the edition of the labels
		
		label1.setEditable(true);
		label2.setEditable(true);
		label3.setEditable(true);
		label4.setEditable(true);
		label5.setEditable(true);
		label6.setEditable(true);
		label7.setEditable(true);
		label8.setEditable(true);
		label12.setEditable(true);
		label13.setEditable(true);
		
		
		//button register appears to allow the user to store the new data
		JButton register= new JButton("Register");
		infopanel.add(register);
		infopanel.validate();
		
		String pastfirstname=label1.getText();
		String pastlastname=label2.getText();
		
		RegisterListener listener =new RegisterListener(pastfirstname, pastlastname, this, this);
		register.addActionListener(listener);
	
			
		
	}
	
		
	}
	
	


